home *** CD-ROM | disk | FTP | other *** search
/ Otherware / Otherware_1_SB_Development.iso / mac / hypercar / xcmd / macintal.sit / MacinTalk Stack / card_6370.txt < prev    next >
Encoding:
Text File  |  1989-05-27  |  6.5 KB  |  274 lines

  1. -- card: 6370 from stack: in
  2. -- bmap block id: 7680
  3. -- flags: 0000
  4. -- background id: 6414
  5. -- name: Speak and Spell
  6. ----- HyperTalk script -----
  7. --- "Speak and Spell" card
  8. --- Globals:
  9. ---    SaS_wordlist         list of words
  10. ---    SaS_numberofwords    number of words left
  11. ---    SaS_wordnumber       number of selected word
  12. ---    SaS_currentword      current word
  13. ---    SaS_currentphonemes  phonemes of current word
  14.  
  15. on openCard
  16.   global SaS_numberofwords, SaS_wordlist
  17.   set lockScreen to true
  18.   --- get list of words
  19.   put card field "word list" of card "Word List" into SaS_wordlist
  20.   put number of lines in SaS_wordlist into SaS_numberofwords
  21.   put empty into card field "userinput"
  22.   send setSlider to bg button "Slider"
  23.   --- this is a bug...
  24.   --- choose lasso tool
  25.   --- doMenu "Select"
  26.   --- doMenu "Opaque"
  27.   --- choose browse tool
  28.   set lockscreen to false
  29.   speak "Welcome to Speak and Spell"
  30.   speak "Enter your answers by typing."
  31.   wait 20
  32.   ControlLock "on"
  33.   send mouseUp to card button "Next"
  34. end openCard
  35.  
  36. on closeCard
  37.   global SaS_wordlist, SaS_currentword, SaS_currentphonemes, SaS_wordnumber
  38.   controlLock "Off"
  39.   -- clear globals - should enable garbage collection to relcaim store
  40.   put empty into SaS_wordlist
  41.   put empty into SaS_currentword
  42.   put empty into SaS_currentphonemes
  43.   put empty into SaS_wordnumber
  44. end closeCard
  45.  
  46. on checkAnswer
  47.   global SaS_currentword, SaS_numberofwords, SaS_wordnumber, SaS_currentphonemes, SaS_wordlist
  48.   if card field userinput = SaS_currentword then
  49.     put SaS_currentphonemes into it
  50.     delete last char of it
  51.     speak phonemes,"YUW SPEH1LT " & it & "KOHRREH1KTLIY. #"
  52.     delete line SaS_wordnumber of SaS_wordlist
  53.     subtract 1 from SaS_numberofwords
  54.     if SaS_numberofwords = 0 then
  55.       speak "You have spelt correctly all the words which I know!"
  56.       speak "Goodbye."
  57.       go to card "Introduction"
  58.     else
  59.       send mouseUp to card button "Next"
  60.     end if
  61.   else
  62.     speak phonemes,SaS_currentphonemes
  63.     speak "is not spelt that way. Either try again or press next to skip."
  64.     put "" into card field userinput
  65.   end if
  66. end checkAnswer
  67.  
  68. on controlKey num
  69.   if (num >= 97 and num <= 122) or num = 8 or num = 13 or num = 3 then
  70.     click at loc of bg button ("K" & num)
  71.   else if num >= 65 and num <= 90 then
  72.     click at loc of bg button ("K" & (num + 32))
  73.   else if num = 28 then arrowKey left
  74.   else if num = 29 then arrowKey right
  75. end controlKey
  76.  
  77.  
  78.  
  79. -- part 4 (button)
  80. -- low flags: 00
  81. -- high flags: 8001
  82. -- rect: left=432 top=25 right=79 bottom=504
  83. -- title width / last selected line: 0
  84. -- icon id / first selected line: 1005 / 1005
  85. -- text alignment: 1
  86. -- font id: 0
  87. -- text size: 12
  88. -- style flags: 0
  89. -- line height: 16
  90. -- part name: Edit dictionary
  91. ----- HyperTalk script -----
  92. on mouseUp
  93.   visual effect iris open
  94.   go to next card
  95. end mouseUp
  96.  
  97.  
  98.  
  99. -- part 5 (button)
  100. -- low flags: 00
  101. -- high flags: 0000
  102. -- rect: left=4 top=84 right=115 bottom=37
  103. -- title width / last selected line: 0
  104. -- icon id / first selected line: 30557 / 30557
  105. -- text alignment: 1
  106. -- font id: 0
  107. -- text size: 12
  108. -- style flags: 0
  109. -- line height: 16
  110. -- part name: 
  111. ----- HyperTalk script -----
  112. on mouseUp
  113.   visual effect dissolve
  114.   go to card "Introduction"
  115. end mouseUp
  116.  
  117.  
  118.  
  119. -- part 6 (button)
  120. -- low flags: 00
  121. -- high flags: 0000
  122. -- rect: left=4 top=26 right=57 bottom=37
  123. -- title width / last selected line: 0
  124. -- icon id / first selected line: 1011 / 1011
  125. -- text alignment: 1
  126. -- font id: 0
  127. -- text size: 12
  128. -- style flags: 0
  129. -- line height: 16
  130. -- part name: 
  131. ----- HyperTalk script -----
  132. on mouseUp
  133.   go home
  134. end mouseUp
  135.  
  136.  
  137.  
  138. -- part 7 (button)
  139. -- low flags: 00
  140. -- high flags: A003
  141. -- rect: left=309 top=109 right=131 bottom=453
  142. -- title width / last selected line: 0
  143. -- icon id / first selected line: 0 / 0
  144. -- text alignment: 1
  145. -- font id: 0
  146. -- text size: 12
  147. -- style flags: 0
  148. -- line height: 16
  149. -- part name: Am I right? (Return)
  150. ----- HyperTalk script -----
  151. on mouseUp
  152.   controlKey 13
  153. end mouseUp
  154.  
  155.  
  156.  
  157. -- part 8 (button)
  158. -- low flags: 00
  159. -- high flags: A003
  160. -- rect: left=220 top=81 right=103 bottom=453
  161. -- title width / last selected line: 0
  162. -- icon id / first selected line: 0 / 0
  163. -- text alignment: 1
  164. -- font id: 0
  165. -- text size: 12
  166. -- style flags: 0
  167. -- line height: 16
  168. -- part name: Erase last letter (Backspace)
  169. ----- HyperTalk script -----
  170. on mouseUp
  171.   controlKey 8
  172. end mouseUp
  173.  
  174.  
  175.  
  176. -- part 9 (button)
  177. -- low flags: 00
  178. -- high flags: A003
  179. -- rect: left=52 top=80 right=102 bottom=195
  180. -- title width / last selected line: 0
  181. -- icon id / first selected line: 0 / 0
  182. -- text alignment: 1
  183. -- font id: 0
  184. -- text size: 12
  185. -- style flags: 0
  186. -- line height: 16
  187. -- part name: Erase all letters
  188. ----- HyperTalk script -----
  189. on mouseUp
  190.   put "" into card field userinput
  191. end mouseUp
  192.  
  193.  
  194.  
  195. -- part 10 (button)
  196. -- low flags: 00
  197. -- high flags: A003
  198. -- rect: left=53 top=108 right=131 bottom=195
  199. -- title width / last selected line: 0
  200. -- icon id / first selected line: 0 / 0
  201. -- text alignment: 1
  202. -- font id: 0
  203. -- text size: 12
  204. -- style flags: 0
  205. -- line height: 16
  206. -- part name: Say it again please
  207. ----- HyperTalk script -----
  208. on mouseUp
  209.   global SaS_currentphonemes
  210.   speak phonemes,SaS_currentphonemes
  211. end mouseUp
  212.  
  213.  
  214.  
  215. -- part 11 (button)
  216. -- low flags: 00
  217. -- high flags: A003
  218. -- rect: left=52 top=137 right=159 bottom=454
  219. -- title width / last selected line: 0
  220. -- icon id / first selected line: 0 / 0
  221. -- text alignment: 1
  222. -- font id: 0
  223. -- text size: 12
  224. -- style flags: 0
  225. -- line height: 16
  226. -- part name: Next
  227. ----- HyperTalk script -----
  228. on mouseUp
  229.   global SaS_currentword, SaS_numberofwords, SaS_wordnumber, SaS_currentphonemes, SaS_wordlist
  230.   put "" into card field userinput
  231.   put random(SaS_numberofwords) into SaS_wordnumber
  232.   put item 1 of line SaS_wordnumber of SaS_wordlist into SaS_currentword
  233.   put item 2 of line SaS_wordnumber of SaS_wordlist into SaS_currentphonemes
  234.   speak "How do you spell"
  235.   speak phonemes,SaS_currentphonemes
  236. end mouseUp
  237.  
  238.  
  239.  
  240. -- part 13 (field)
  241. -- low flags: 01
  242. -- high flags: 0002
  243. -- rect: left=91 top=185 right=215 bottom=413
  244. -- title width / last selected line: 0
  245. -- icon id / first selected line: 0 / 0
  246. -- text alignment: 0
  247. -- font id: 3
  248. -- text size: 18
  249. -- style flags: 256
  250. -- line height: 24
  251. -- part name: userinput
  252. ----- HyperTalk script -----
  253. on returnKey
  254.   click at loc of card button "Am I right?"
  255. end returnKey
  256.  
  257.  
  258. -- part 14 (field)
  259. -- low flags: 01
  260. -- high flags: 0004
  261. -- rect: left=176 top=27 right=55 bottom=350
  262. -- title width / last selected line: 0
  263. -- icon id / first selected line: 0 / 0
  264. -- text alignment: 1
  265. -- font id: 3
  266. -- text size: 18
  267. -- style flags: 256
  268. -- line height: 24
  269. -- part name: 
  270.  
  271.  
  272. -- part contents for card part 14
  273. ----- text -----
  274. Speak and Spell